import { request, formRequest } from '../utils/request';

export async function fetchActivityList(params) {
  return request('adminapi/admin/act/getActList', {
    method: 'POST',
    body: params,
  });
}


export async function upActList(params) {
  return request('adminapi/admin/act/upActList', {
    method: 'POST',
    body: params,
  });
}

export async function downActList(params) {
  return request('adminapi/admin/act/downActList', {
    method: 'POST',
    body: params,
  });
}

export async function delActList(params) {
  return request('adminapi/admin/act/delActList', {
    method: 'POST',
    body: params,
  });
}

export async function addImage(params) {
  console.log('params', params);
  let file = params;
  console.log('上传的图片-----' + file)
  return formRequest('prodapi/goods/upload/addGoodsShowImg', {
    method: 'POST',
    body: {},
  },
   file 
  );
}

export async function appointDay(params){
  return request('adminapi/admin/act/appointDay', {
    method: 'POST',
    body: params,
  });
}

export async function addActivity(params) {
  let file = params.name;
  delete params.name;
  delete params.authorName;
  return formRequest('adminapi/admin/act/addAct', {
    method: 'POST',
    body: params,
  },
    file
  );
}

export async function editActivity(params) {
  let file = params.name;
  delete params.name;
  delete params.authorName;

  return formRequest('adminapi/admin/act/updateAct', {
    method: 'POST',
    body: params,
  },
    file
  );
}


export async function fetchActDetail(params) {
  return request('adminapi/admin/act/getActDetail', {
    method: 'POST',
    body: params,
  });
}

export async function getUserActTimeHistory(params) {
  return request('adminapi/admin/act/getUserActTimeHistory', {
    method: 'POST',
    body: params,
  });
}

export async function getActDateTimes(params) {
  return request('adminapi/admin/act/getActDateTimes', {
    method: 'POST',
    body: params,
  });
}

export async function actWriteOff(params) {
  return request('adminapi/admin/act/actWriteOffAppoint', {
    method: 'POST',
    body: params,
  });
}

